package com.array;

/***
 * @ClassName: TwoDArray
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 16:01 2022/1/25
 * @version : V1.0
 */
public class TwoDArray {
    public static void main(String[] args) {

        //创建一个4行6列的二维数组
        int [] [] a = new int[3][5];
        twoD();

        threeD();
    }

    static void twoD(){

        /*
        * 1 2
        * 2 3
        * 3 4
        * */
        int [] [] twoDArray = {{1,2},{2,3},{3,4}};
        int[] ints = twoDArray[0];//{1,2}
        int anInt = ints[1];//2
        System.out.println(anInt);

        int i = twoDArray[1][0];//第1行第0列  ----》  2
        System.out.println(i);
    }

    static void threeD(){
        //三维数组
        int [] [] [] b = {{{1,2},{2,3}},{{3,4},{5,6}}};
        int i = b[1][1][0];
        System.out.println(i);

        for (int[][] ints : b) {
            for (int[] anInt : ints) {
                for (int i1 : anInt) {
                    System.out.print(i1+" ");
                }
            }
        }
    }
}
